use std::path::PathBuf;
use clap::{Parser, Subcommand};

fn main() {
    let args = MyArgs::parse();
    println!("args:{args:?}");
    println!("Hello, world!");
}

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct MyArgs {
    /// 名称，可选
    name: Option<String>,

    /// 配置文件
    #[arg(short, long, value_name = "FILE")]
    config: Option<PathBuf>,

    #[command(subcommand)]
    command: Commands,
}
#[derive(Subcommand, Debug)]
enum Commands {
    /// 启动开发服务器
    Dev {
        /// 监听端口号
        #[arg(short, long, default_value = "14200")]
        port: i32
    },
    /// 构建文档
    Build {
        /// 输出的格式
        #[arg(short, long, default_value = "html")]
        format: String
    },
}